﻿cmake_minimum_required(VERSION 3.5.0)
project(Sample VERSION 0.1.0 LANGUAGES C CXX)

include_directories(${PROJECT_SOURCE_DIR}/lib_DP100)
aux_source_directory(${PROJECT_SOURCE_DIR}/Sources SRC_LIST)
find_library(LIB_DP100 DP100 ${PROJECT_SOURCE_DIR}/lib_DP100)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})

add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${LIB_DP100})

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD

                    COMMAND ${CMAKE_COMMAND} -E copy
                    ${PROJECT_SOURCE_DIR}/lib_DP100/DP100.dll
                    ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/DP100.dll   # 目标目录
                    COMMENT "Copy ${PROJECT_SOURCE_DIR}/export/DP100.dll to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/DP100.dll"
                    
                    COMMAND ${CMAKE_COMMAND} -E copy
                    ${PROJECT_SOURCE_DIR}/lib_DP100/ATK-DP100DLL.dll
                    ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/ATK-DP100DLL.dll   # 目标目录
                    COMMENT "Copy ${PROJECT_SOURCE_DIR}/export/ATK-DP100DLL.dll to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/ATK-DP100DLL.dll")